package week2;

import java.util.Arrays;
import java.util.Scanner;

public class Main2{

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n,k=0 ;
		int[] x=new int[200];
		while(sc.hasNext()){
			String strs1 = sc.next();
			switch(strs1){
		
				case "fib":
					n = sc.nextInt();
					for(int i=1;i<=n;i++){
						if(i==n){
							System.out.print(fib(i));
							System.out.print("\n");
						}
						else
							System.out.print(fib(i)+" ");
					}
					break;
				case "sort":
					String  a= sc.nextLine();
						a= sc.nextLine();
						String m[]=a.split(" ");
						int y[]=new int[m.length];
						for(int i=0;i<m.length;i++){
							
							y[i]=Integer.parseInt(m[i]);
						}
						k=m.length;
						x=y;
						Arrays.sort(y);
						System.out.println(Arrays.toString(y));
						break;
				
				case "search":
					n = sc.nextInt();
					if (k>0){
					if(Arrays.binarySearch(x,n)<0)
						System.out.println(-1);
					else
						System.out.println(Arrays.binarySearch(x,n));
					}
					else
						System.out.println(-1);
					break;
				case "getBirthDate":
					n = sc.nextInt();
					String[] strs=new String [n];
					for(int i=0;i<n;i++){
						strs[i] = sc.next();
					}
				for(int i=0;i<n;i++){
					System.out.println(strs[i].substring(6,10)+"-"+strs[i].substring(10,12)+"-"+strs[i].substring(12,14));
				}
				break;
			default:
				System.out.println("exit");
				System.exit(0);
				break;
				
			}
		}	
		
		

	}
	public static int fib(int n){
		if(n==1||n==2)
			return 1;
		else
			return fib(n-1)+fib(n-2);
	}

}

